﻿using System.Xml.Linq;
using Microsoft.Data.Entity.Design.Extensibility;
using System.ComponentModel;

namespace Liekhus.EntityFramework.XAFExtensions.CustomAttributes
{
    public class RuleRequiredMessageProperty : BaseCustomAttribute<string>
    {
        public RuleRequiredMessageProperty(XElement parent, PropertyExtensionContext context)
            : base(parent, context)
        {

        }

        public override string PropertyName { get { return "RuleRequiredField"; } }
        public override string PropertyFormat { get { return "[RuleRequiredField(\"{entity}_{property}_RuleRequiredField\", DefaultContexts.Save, \"{value}\")]"; } }

        [DisplayName("Rule Required Message")]
        [Description("The message to display to the user when a field is required.  By setting this value, it forces the field to be required.")]
        public override string PropertyValue
        {
            get
            {
                return base.PropertyValue;
            }
            set
            {
                base.PropertyValue = value;
            }
        }
    }
}
